package com.fourth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fourth.dao.SortDao;
import com.fourth.service.SortService;
import com.fourth.vo.BrandVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ljx.entity.Deposit;
import com.ljx.entity.Sort;
import com.ljx.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiaoZhu
 * @version 1.0
 * @date 2023/2/27 21:57
 */
@Service
public class SortServiceImpl extends ServiceImpl<SortDao, Sort> implements SortService {
    @Autowired
    private  SortDao sortDao;
    @Override
    public Result selectAll(Integer currentPage, Integer PageSize,Sort sort) {
        PageHelper.startPage(currentPage,PageSize);
        QueryWrapper<Sort> wrapper = new QueryWrapper<>();
            if (sort.getId()!=null || sort.getStatus()!=null){
                List<Sort> list1 = sortDao.selectListAll(sort.getStatus(),sort.getId());
                PageInfo<Sort> info1 = new PageInfo<>(list1);
                return new Result(200, "查询成功", info1);
            }
            List<Sort> list = sortDao.selectList(null);
            PageInfo<Sort> info = new PageInfo<>(list);
            return new Result(200, "查询成功", info);

    }
}
